<template>
  <div class="user-page">
    <div class="page-container">
      <!-- 欢迎区域 -->
      <div class="welcome-section">
        <div class="welcome-content animate__animated animate__fadeInUp">
          <div class="welcome-icon">🤖</div>
          <h1 class="welcome-title gradient-text">欢迎使用 AI梦工厂</h1>
          <p class="welcome-description">
            发现最前沿的AI工具，提升您的工作效率
          </p>
        </div>
      </div>

      <!-- 产品展示区域 -->
      <div class="products-showcase">
        <h2 class="section-title">热门产品</h2>
        <div class="products-grid">
          <div 
            v-for="product in popularProducts" 
            :key="product.id"
            class="product-card tiktok-card animate__animated animate__fadeInUp"
            @click="$router.push(`/products/${product.id}`)"
          >
            <div class="product-icon">{{ product.icon }}</div>
            <h3 class="product-name">{{ product.name }}</h3>
            <p class="product-description">{{ product.description }}</p>
            <div class="product-price gradient-text">
              ¥{{ product.pricing.monthly }}/月
            </div>
          </div>
        </div>
      </div>

      <!-- 功能介绍区域 -->
      <div class="features-section">
        <h2 class="section-title">平台特色</h2>
        <div class="features-grid">
          <div class="feature-item animate__animated animate__fadeInUp">
            <div class="feature-icon">🚀</div>
            <h3 class="feature-title">简单易用</h3>
            <p class="feature-description">无需复杂配置，即买即用，快速体验AI工具的强大功能</p>
          </div>
          <div class="feature-item animate__animated animate__fadeInUp">
            <div class="feature-icon">💎</div>
            <h3 class="feature-title">优质产品</h3>
            <p class="feature-description">精选最优秀的AI工具，为您提供最佳的使用体验</p>
          </div>
          <div class="feature-item animate__animated animate__fadeInUp">
            <div class="feature-icon">🔒</div>
            <h3 class="feature-title">安全可靠</h3>
            <p class="feature-description">保障您的数据安全，提供稳定可靠的服务支持</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useAppStore } from '@/stores'

const appStore = useAppStore()

// 计算属性
const popularProducts = computed(() => appStore.popularProducts)
</script>

<style scoped>
.user-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  padding-top: 64px;
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* 欢迎区域 */
.welcome-section {
  text-align: center;
  padding: 80px 0;
}

.welcome-content {
  max-width: 600px;
  margin: 0 auto;
}

.welcome-icon {
  font-size: 80px;
  margin-bottom: 24px;
}

.welcome-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.welcome-description {
  font-size: 1.2rem;
  color: #cccccc;
  line-height: 1.6;
  margin-bottom: 32px;
}

/* 产品展示区域 */
.products-showcase {
  margin-bottom: 80px;
}

.section-title {
  font-size: 2rem;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  margin-bottom: 40px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.product-card {
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(254, 44, 85, 0.1);
}

.product-card:hover {
  transform: translateY(-8px);
  border-color: rgba(254, 44, 85, 0.3);
  box-shadow: 0 20px 40px rgba(254, 44, 85, 0.1);
}

.product-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.product-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 12px;
}

.product-description {
  color: #cccccc;
  line-height: 1.6;
  margin-bottom: 16px;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 600;
}

/* 功能介绍区域 */
.features-section {
  margin-bottom: 80px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  margin-top: 40px;
}

.feature-item {
  text-align: center;
  padding: 40px 20px;
}

.feature-icon {
  font-size: 60px;
  margin-bottom: 20px;
}

.feature-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 16px;
}

.feature-description {
  color: #cccccc;
  line-height: 1.6;
}

/* 渐变文本 */
.gradient-text {
  background: linear-gradient(90deg, #FE2C55, #8B5CF6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* TikTok风格卡片 */
.tiktok-card {
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-container {
    padding: 20px 16px;
  }
  
  .welcome-title {
    font-size: 2rem;
  }
  
  .welcome-icon {
    font-size: 60px;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
</style>